<template>
  <j-modal
    :title="title"
    :width="1200"
    :visible="visible"
    :maskClosable="false"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }"
    @cancel="handleCancel"
  >
    <j-vxe-table
      keep-source
      ref="orderTable"
      :loading="loading"
      :columns="columns"
      :dataSource="dataSource"
      :maxHeight="300"
      @selectRowChange="onSelectRowChange"
      :rowNumber="true"
      :rowSelection="true"
      :toolbar="true"
      :toolbarConfig="{ slot: ['prefix', 'suffix'], btn: ['remove', 'clearSelection'] }"
    />
  </j-modal>
</template>

<script>
import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
import { JVXETypes } from '@/components/jeecg/JVxeTable'
import { getAction } from '@/api/manage'
export default {
  name: 'SelectWaitSummaryTradeOrderModal',
  components: {},
  mixins: [JVxeTableModelMixin],
  data() {
    return {
      title: '选择待汇总营销订单',
      width: 800,
      visible: false,
      loading: false,
      dataSource: [],
      selectedRows: [],
      url:'/review/bussInternationalTradeOrders/listWaitSummary',
      columns: [
        {
          title: '营销订单编号',
          key: 'code',
          type: JVXETypes.normal,
          width: '150px',
          placeholder: '请输入${title}',
          defaultValue: '',
        },
        {
          title: '订货数量',
          key: 'weight',
          type: JVXETypes.normal,
          width: '100px',
          placeholder: '请输入${title}',
          defaultValue: '',
        },
        {
          title: '单位',
          key: 'weightUnit',
          type: JVXETypes.select,
          disabled: true,
          width: '100px',
          dictCode: 'zl_unit',
          placeholder: '请输入${title}',
          defaultValue: '',
        },
        {
          title: '交货日期',
          key: 'deliveryDate',
          type: JVXETypes.normal,
          width: '200px',
          placeholder: '请输入${title}',
          defaultValue: '',
        },

        {
          title: '评审说明',
          key: 'reviewRemark',
          type: JVXETypes.normal,
          width: '300px',
          placeholder: '请输入${title}',
          defaultValue: '',
        },
      ],
      disableSubmit: false,
    }
  },
  methods: {
    onSelectRowChange({ type, action, selectedRows, $event }) {
      this.selectedRows = selectedRows
    },
    add() {
      this.visible = true
      this.loading = true
      getAction(this.url).then((res) => {
        this.loading = false
        console.log(res)
        if (res.success) {
          this.dataSource = res.result
        }
      })
    },
    close() {
      this.$emit('close')
      this.visible = false
    },
    handleOk() {
      this.$emit('orderOk', this.selectedRows)
      this.visible = false
    },
    submitCallback() {
      this.$emit('ok')
      this.visible = false
    },
    handleCancel() {
      this.close()
    },
  },
}
</script>

<style scoped></style>
